﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace Project01
{
    class MonsterType03:Monster
    {
       
        //Dữ liệu về Monster03
        private enum MoveState { Move1, Move2, Move3, Move4 }
        MoveState movestate;
        private Vector2 MoveVector;
        public MonsterType03(Game game)
            : base(game)
        {
                this.ObjectTexture = game.Content.Load<Texture2D>("Images/Monster/Mtype03");
                this.Sprite = new AnimationSprite(ObjectTexture, 1, 6);
                this.Speed = 5;
                this.Health = 4;
                this.game = game;
                movestate = MoveState.Move1;
                this.Sprite.Origin = new Vector2(this.Sprite.RecWidth, this.Sprite.RecHeight);
                if (Sprite.Position.X >= game.Window.ClientBounds.Width / 2)
                {
                    MoveVector = new Vector2(-Speed, Speed);
                }
                else
                {
                    MoveVector = new Vector2(Speed, Speed);
                }
        }
     
        public override void Update(GameTime gameTime)
        {
            Exp.Sprite.Position = SetPositionExplosion(Sprite.Position, 10, 0);
                  Sprite.Update();
                  if (Sprite.Position.X >= game.Window.ClientBounds.Width || Sprite.Position.X <=0+Sprite.RecWidth)
                      movestate = MoveState.Move4;
                  if (movestate == MoveState.Move1)
                  {
                      Sprite.Position.Y -= MoveVector.Y;
                      if (Sprite.Position.Y <= game.Window.ClientBounds.Height / 6)
                          movestate = MoveState.Move2;
                  }
                  else if (movestate == MoveState.Move2)
                  {
                      Sprite.Position.Y += MoveVector.Y;
                      Sprite.Position.X += MoveVector.X;
                      if (Sprite.Position.Y > game.Window.ClientBounds.Height / 3)
                          movestate = MoveState.Move3;
                  }
                  else if (movestate == MoveState.Move3)
                  {
                      Sprite.Position.Y -= MoveVector.Y;
                      Sprite.Position.X += MoveVector.X;

                      if (Sprite.Position.Y <= game.Window.ClientBounds.Height / 6)
                          movestate = MoveState.Move2;
                      
                  }
                  else if (movestate == MoveState.Move4)
                  {
                      Sprite.Position.Y += MoveVector.Y;
                      Active = CheckPosition(Sprite.Position);
                  }

                      
                
                  base.Update(gameTime);
        }
        public override void Draw(SpriteBatch SpriteBatch)
        {
          
            base.Draw(SpriteBatch);
        }
    }
}
